﻿using System;
using System.Collections.Generic;
using System.Linq;
using WCFLearnService.Model;

namespace WCFLearnService
{
    public class TestData
    {
        private static readonly List<string> UserName = new List<string> {"安世界", "钟晓静", "马飞鹰"};

        static TestData()
        {
            Init();
        }

        public static IList<UserModel> Users { get; private set; }

        public static IList<ArticleModel> Articles { get; private set; }

        private static void Init()
        {
            if (Users == null)
                Users =
                    Enumerable.Range(1, UserName.Count)
                        .Select(
                            x =>
                                new UserModel
                                {
                                    Uid = x.ToString(),
                                    Name = UserName[x - 1],
                                    Pwd = Guid.NewGuid().ToString()
                                })
                        .ToList();
            if (Articles == null)
                Articles = new List<ArticleModel>
                {
                    new ArticleModel {Aid = "1", Author = "Shweta Lodha", Name = "Which WCF Template To Be Used"},
                    new ArticleModel {Aid = "2", Author = "Nitin Pandit", Name = "WCF Interview Questions and Answers"},
                    new ArticleModel
                    {
                        Aid = "3",
                        Author = "Chamali Perera",
                        Name = "Accessing Microsoft Dynamics CRM Web APIs Using Self-Hosted WCF Services"
                    }
                };
        }
    }
}